package com.nuanshui.heatedloan.web.credit;

import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSON;
import com.beust.jcommander.internal.Maps;
import com.nuanshui.framework.lang.MoneyUtil;
import com.nuanshui.framework.utils.LogUtil;
import com.nuanshui.heatedloan.constant.GlobalParam;
import com.nuanshui.heatedloan.credit.facade.AllinPayRecordService;
import com.nuanshui.heatedloan.credit.model.record.AllinPayBillRecord;
import com.nuanshui.heatedloan.fund.enums.PaymentBizType;
import com.nuanshui.heatedloan.fund.facade.UserAccountBillService;
import com.nuanshui.heatedloan.fund.facade.UserFundActionService;
import com.nuanshui.heatedloan.fund.form.UserAccountBillForm;
import com.nuanshui.heatedloan.fund.model.UserAccountBill;
import com.nuanshui.heatedloan.fund.vo.UserAccountBillVO;
import com.nuanshui.heatedloan.msgcenter.constant.SmsMsgBizType;
import com.nuanshui.heatedloan.msgcenter.integration.MsgTools;
import com.nuanshui.heatedloan.msgcenter.model.AliSmsNotificationCodeTemp;
import com.nuanshui.heatedloan.msgcenter.model.SmsPushMsgBody;
import com.nuanshui.heatedloan.pageable.Pager;
import com.nuanshui.heatedloan.web.ApiController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/cms/manage/allinpaybill")
public class AllinPayBillController extends ApiController {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@Reference(url = GlobalParam.CREDIT_DUBBO_SERVER, timeout = GlobalParam.DUBBO_SERVER_TIME_OUT, version = GlobalParam.CREDIT_DUBBO_SERVER_VERSION)
	private AllinPayRecordService allinPayRecordService;

	@RequestMapping("/list")
	public String list(Pager<AllinPayBillRecord> pager, String query) {

		AllinPayBillRecord itemEntity = null;
		if (StringUtils.isNotEmpty(query) && !DEFAULTQUERYSTR.equals(query)) {
			itemEntity = JSON.parseObject(query, AllinPayBillRecord.class);
		}
		pager = allinPayRecordService.findBillListByPage(pager, itemEntity);

		return success(pager.asHashMap());
	}
}
